#include<stdio.h>
#include<stdlib.h>

#define MAX_LENGTH 114514

int main(){
    char datain[MAX_LENGTH];
    char bufferc;
    int cnt=0;
    FILE *file;
    while('#' != (bufferc=getchar()))
    {
        datain[cnt]=bufferc;
        cnt++;
    }
    datain[cnt]='\0';
    file = fopen("D:\\f1.txt","w");
    if(file==NULL)
    {
        perror("fail");
        return 1;
    }
    fputs(datain,file);
    fclose(file);
    file = fopen("D:\\f1.txt","w");
    if(file==NULL)
    {
        perror("fail");
        return 1;
    }
    printf("\ndata from f1.txt:\n");
    while((bufferc=fgetc(file))!=EOF)
    {
        printf("%c",bufferc);
    }
    fclose(file);
    return 0;
}